package com.ymttest.business.service.shenqi.bean;

import com.shop2cn.iapi.agentproducts.parameter.UpdateStockDto;
import com.shop2cn.iapi.prodstock.parameter.OpenAdjustStockBean;
import com.shop2cn.iapi.prodstock.service.OpenAdjustStockCall;
import com.ymttest.utils.TestDataManager;

import java.io.IOException;
import java.util.Arrays;

public class SqStockService {

    public static void OpenAdjustStock(long goodsOwnerId, String productId, String catalogId) throws IOException {
    	//核销完成后总线回调 http://sqoptrade.iapi.shop2cn.com/api/Notify/preSaleStockWriteOff	{"sellerId":500024716,"catalogId":"c34302090"}
        OpenAdjustStockBean openadjuststockBean = new OpenAdjustStockBean();
        OpenAdjustStockCall openadjuststockCall = new OpenAdjustStockCall();

        openadjuststockBean.setUserId((int) goodsOwnerId);
        openadjuststockBean.setBizNo(TestDataManager.getRandomNum(36));
        openadjuststockBean.setUpdateStockList(
                Arrays.asList(new UpdateStockDto(productId, catalogId, catalogId, 10, 0)));

        openadjuststockCall.setData(openadjuststockBean);
        openadjuststockCall.callService();
    }
}
